package com.hrma.controller;

import com.hrma.entity.WorkSchedule;
import com.hrma.entity.WorkSchedulePO;
import com.hrma.services.WorkScheduleService;
import com.hrma.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/workSchedule")
@Slf4j
public class WorkScheduleController {
    private final WorkScheduleService workScheduleService;

    public WorkScheduleController(WorkScheduleService workScheduleService) {
        this.workScheduleService = workScheduleService;
    }

    @PatchMapping("/update")
    public Result<?> update(@RequestBody WorkSchedule data){
        log.debug("收到update请求,请求参数:{}",data);
        workScheduleService.update(data);
        return Result.ok(data);
    }

    @GetMapping("/getTime")
    public Result<WorkSchedule> getTime() {
        log.debug("收到getTime请求!");
        return Result.ok(workScheduleService.getTime());
    }
}
